package com.zqcy.workbench.adapter;

import android.content.Context;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.zqcy.workbench.R;
import com.zqcy.workbench.bean.TabConfiguration;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

public class TabAdapter extends BaseQuickAdapter<TabConfiguration, BaseViewHolder> {
    private Context context;

    public TabAdapter(Context context, @Nullable List<TabConfiguration> data) {
        super(R.layout.item_tab_configuration, data);
        this.context = context;
    }

    @Override
    protected void convert(@NotNull BaseViewHolder helper, TabConfiguration item) {
        helper.setText(R.id.tab_configuration_text, context.getResources().getString(item.getTabName()));
        helper.getView(R.id.tab_configuration_img).setBackgroundResource(item.getTabIcon());
    }
}
